/*
 * Copyright 2024-2025 NXP
 * NXP Proprietary. This software is owned or controlled by NXP and may only be used
 * strictly in accordance with the applicable license terms. By expressly accepting such terms or by
 * downloading, installing, activating and/or otherwise using the software, you are agreeing that you
 * have read, and that you agree to comply with and are bound by, such license terms. If you do not
 * agree to be bound by the applicable license terms, then you may not retain, install, activate or
 * otherwise use the software.
 */

/*
 * Note:
 * THIS FILE IS AUTO-GENERATED BY TIME SERIES STUDIO. DO NOT MODIFY!
 */

#ifndef _TIMESERIES_H_
#define _TIMESERIES_H_

#define ANOMALY_DETECTION_LIB_ID "99cc067f9841d8"

#define TSS_INPUT_DATA_LEN                           (128)
#define TSS_INPUT_DATA_DIM                           (3)

#define USE_ANOMALY_DETECTION

#define TSS_RECOMMEND_THRESHOLD                      (0.90f)

/* Error status returned functions in the Time Series Studio library */
typedef enum
{
    TSS_SUCCESS                 = 0, /* No error */
    TSS_STATE_ERROR             = 1, /* State is incorrect */
    TSS_BOARD_ERROR             = 2, /* Board information is incorrect */
    TSS_MEMORY_ERROR            = 3, /* Memory error caused by the HEAP Overflow */
    TSS_PREDICT_NOT_ENABLED     = 4, /* Predict function is not enabled */
    TSS_LEARNING_ERROR          = 5, /* Errors occurs during the learning process */
    TSS_LEARNING_NOT_ENOUGH     = 6, /* Not enough calls to learning */
    TSS_RECOMMEND_LEARNING_DONE = 7, /* Reached the recommended calls to learning */
    TSS_NOT_READY               = 8, /* Function is not ready but planed to support */
    TSS_LICENSE_ERROR           = 9, /* Invalid license */
    TSS_UNKNOWN_ERROR           = 10, /* Unknown error */
} tss_status;

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief      Initialize the anomaly detection algorithm.
 * @retval     TSS_SUCCESS              - Initialization succeed.
 */
tss_status tss_ad_init(void);

/**
 * @brief      Predict the normal probability of the specified data.
 * @param[in]  data_input               - The data input for the prediction.
 * @param[out] probability              - The predicted probability output.
 * @retval     TSS_SUCCESS              - Prediction succeed.
 * @retval     TSS_PREDICT_NOT_ENABLED  - Model not ready for prediction.
 */
tss_status tss_ad_predict(const float data_input[], float *probability);

#ifdef __cplusplus
}
#endif

#endif /* _TIMESERIES_H_ */